﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace aDream.Entity_Domain
{
    public class Assets
    {
        private List<Asset> assets = new List<Asset>();
       
        
        public void add(int idProperty, int quantity, String description)
        {
            int idAsset = getNextAssetID();
            String sql1 = "Insert into Asset(idAsset, quantity, description) values (" + idAsset + ", " + quantity + ", '" + description + "');";

            String sql2 = "Insert into AssetManagement(idProperty, idAsset) values (" + idProperty + ", " + idAsset + ");";
        }

        private int getNextAssetID()
        {
            DataConnection connection = new DataConnection();
            DataTable dt;
            dt = connection.ExecuteReturningQuery("Select max(idAsset) from Asset;");
            int last = Convert.ToInt32(dt.Rows[0].ItemArray[0]);
            return last + 1;
        }
        
    }


}
